home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / GetPPPStatus / MoreFinderEvents.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  11.8 KB  |  291 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MoreFinderEvents.h
  3.  
  4.     Contains:    Functions to help you build and sending Apple events to the Finder.
  5.  
  6.     Written by: Andy Bachorski    
  7.  
  8.     Copyright:    Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/22/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #ifndef MOREFINDEREVENTS
  24. #define MOREFINDEREVENTS
  25.  
  26. //    System includes
  27. #include <Aliases.h>
  28. #include <AppleScript.h>
  29. #include <Components.h>
  30. #include <Folders.h>
  31. #include <Icons.h>
  32. #include <OSA.h>
  33.  
  34.  
  35.  
  36. enum {
  37.     kFinderFileType            = 'FNDR',
  38.     kFinderCreatorType        = 'MACS'
  39. };
  40.  
  41.  
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. pascal OSErr MFESetSelectionToNone( const AEIdleUPP idleProcUPP );
  48. /*
  49.     Sets the Finder's selection to nothing by sending it an empty list.
  50. */
  51.  
  52. // *****************************************************************************
  53.  
  54. pascal OSErr MFEChangeFolderViewNewSuite( const FSSpecPtr fssPtr,
  55.                                           const long viewStyle,
  56.                                           const AEIdleUPP idleProcUPP );
  57. /*
  58.     Given an FSSpec to a folder and a view constant value from the view by list
  59.     defined in AERegistry.h, send an Apple event to the system 7.5.x Finder asking
  60.     it to set the view of the folder's window to the specified style.
  61.  
  62.     Requires that the folder's window be open, otherwise an error is returned
  63.     in the reply event.
  64.     
  65.     If your application will receive update event (i.e., it has windows), you must
  66.     supply a more complete idle function than the simple idle function included
  67.     with this library. It should pass any updated, activate, null, or osEvt events
  68.     received to your application's do event routine.
  69. */
  70.  
  71. // *****************************************************************************
  72. pascal OSErr MFEChangeFolderViewOldSuite( const FSSpecPtr fssPtr,
  73.                                           const long viewStyle,
  74.                                           const AEIdleUPP idleProcUPP );
  75. /*
  76.     Given an FSSpec to a folder and a view constant value from the view by list
  77.     defined in AERegistry.h, send an Apple event to the system 7.1.1/7.1.2 Finder
  78.     asking it to set the view of the folder's window to the specified style.
  79.     
  80.     If your application will receive update event (i.e., it has windows), you must
  81.     supply a more complete idle function than the simple idle function included
  82.     with this library. It should pass any updated, activate, null, or osEvt events
  83.     received to your application's do event routine.
  84. */
  85.  
  86. // *****************************************************************************
  87.  
  88. pascal OSErr MFEChangeFolderView( const FSSpecPtr fssPtr,
  89.                                   const long viewStyle,
  90.                                   const AEIdleUPP idleProcUPP );
  91. /*
  92.     Given an FSSpec to a folder and a view constant value from the view by list
  93.     defined in AERegistry.h, send an Apple event to the Finder asking it to set
  94.     the view of the folder's window to the specified style.
  95.  
  96.     Requires that the folder's window be open, otherwise an error is returned
  97.     in the reply event.
  98.     
  99.     If your application will receive update event (i.e., it has windows), you must
  100.     supply a more complete idle function than the simple idle function included
  101.     with this library. It should pass any updated, activate, null, or osEvt events
  102.     received to your application's do event routine.
  103. */
  104.  
  105. // *****************************************************************************
  106.  
  107. pascal OSErr MFEAddCustomIconToItem( const FSSpecPtr fssPtr,
  108.                                      const Handle theIconSuite,
  109.                                      const IconSelectorValue iconSelector,
  110.                                      const AEIdleUPP idleProcUPP );
  111.  
  112. /*    
  113.     MFEAddCustomIconToItem adds a custom icon, via the Finder, to the item 
  114.     specified by the fssPtr. 
  115.     If an UPP to an idle function is provided in the idleProcUPP parameter,
  116.     AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
  117.     to nil, kAENoReply will be used for the send mode.
  118.  
  119.     fssPtr            input:    The item to add the custom icon to.
  120.     theIconSuite    input:    The handle to the icon suite to install.
  121.     iconSelector    input:    An IconSelectorValue specifying which icon types
  122.                             to add.
  123.     idleProcUPP        input:    A UniversalProcPtr for an idle function, or nil.
  124.     
  125.     Result Codes
  126.     _____________
  127.     noErr                        0        No error    
  128.     paramErr                    -50        The value of target or alias parameter, or of both,
  129.                                         is NIL or odd, or the alias record is corrupt
  130.     eLenErr                        -92        Buffer too big to send    
  131.     memFullErr                    -108    Not enough room in heap zone    
  132.     procNotFound                -600    No eligible process with specified descriptor
  133.     connectionInvalid            -609    Nonexistent signature or session ID    
  134.     noUserInteractionAllowed    -610    Background application sends event
  135.                                         requiring authentication    
  136.     noPortErr                    -903    Client hasn’t set 'SIZE' resource to indicate
  137.                                         awareness of high-level events    
  138.     destPortErr                    -906    Server hasn’t set 'SIZE' resource to indicate
  139.                                         awareness of high-level events, or else is not present    
  140.     sessClosedErr                -917    The kAEDontReconnect flag in the sendMode parameter
  141.                                         was set and the server quit, then restarted    
  142.     errAECoercionFail             -1700    Data could not be coerced to the 
  143.                                         requested Apple event data type    
  144.     errAEWrongDataType            -1703    Wrong Apple event data type    
  145.     errAENotAEDesc                -1704    Not a valid descriptor record    
  146.     errAEBadListItem            -1705    Operation involving a list item failed    
  147.     errAEEventNotHandled        -1708    Event wasn’t handled by an Apple event handler    
  148.     errAEUnknownSendMode        -1710    Invalid sending mode was passed    
  149.     errAEWaitCanceled            -1711    User canceled out of wait loop for reply or receipt    
  150.     errAETimeout                -1712    Apple event timed out    
  151.     errAEUnknownAddressType        -1716    Unknown Apple event address type    
  152.     Any error code returned by the event handler of the target application.
  153.     ____________
  154. */
  155.  
  156. // *****************************************************************************
  157.  
  158. pascal OSErr MFEGetItemIcon( const FSSpecPtr fssPtr,
  159.                              const AEIdleUPP idleProcUPP,
  160.                                    Handle     *theIconSuite );
  161.  
  162. /*    
  163.     MFEAddCustomIconToItem adds a custom icon, via the Finder, to the item 
  164.     specified by the fssPtr. 
  165.     If an UPP to an idle function is provided in the idleProcUPP parameter,
  166.     AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
  167.     to nil, kAENoReply will be used for the send mode.
  168.  
  169.     fssPtr            input:    The item to add the custom icon to.
  170.     theIconSuite    input:    The handle to the icon suite to install.
  171.     iconSelector    input:    An IconSelectorValue specifying which icon types
  172.                             to add.
  173.     idleProcUPP        input:    A UniversalProcPtr for an idle function, or nil.
  174.     
  175.     Result Codes
  176.     _____________
  177.     noErr                        0        No error    
  178.     paramErr                    -50        The value of target or alias parameter, or of both,
  179.                                         is NIL or odd, or the alias record is corrupt
  180.     eLenErr                        -92        Buffer too big to send    
  181.     memFullErr                    -108    Not enough room in heap zone    
  182.     procNotFound                -600    No eligible process with specified descriptor
  183.     connectionInvalid            -609    Nonexistent signature or session ID    
  184.     noUserInteractionAllowed    -610    Background application sends event
  185.                                         requiring authentication    
  186.     noPortErr                    -903    Client hasn’t set 'SIZE' resource to indicate
  187.                                         awareness of high-level events    
  188.     destPortErr                    -906    Server hasn’t set 'SIZE' resource to indicate
  189.                                         awareness of high-level events, or else is not present    
  190.     sessClosedErr                -917    The kAEDontReconnect flag in the sendMode parameter
  191.                                         was set and the server quit, then restarted    
  192.     errAECoercionFail             -1700    Data could not be coerced to the 
  193.                                         requested Apple event data type    
  194.     errAEWrongDataType            -1703    Wrong Apple event data type    
  195.     errAENotAEDesc                -1704    Not a valid descriptor record    
  196.     errAEBadListItem            -1705    Operation involving a list item failed    
  197.     errAEEventNotHandled        -1708    Event wasn’t handled by an Apple event handler    
  198.     errAEUnknownSendMode        -1710    Invalid sending mode was passed    
  199.     errAEWaitCanceled            -1711    User canceled out of wait loop for reply or receipt    
  200.     errAETimeout                -1712    Apple event timed out    
  201.     errAEUnknownAddressType        -1716    Unknown Apple event address type    
  202.     Any error code returned by the event handler of the target application.
  203.     ____________
  204. */
  205.  
  206. // *****************************************************************************
  207. pascal OSErr MFEGetEveryItemOnDesktop( const AEIdleUPP idleProcUPP,
  208.                                              AEDescList *objectList );
  209. /*    The MFEGetEveryItemOnDesktop function asks the Finder for a list of object
  210.     descriptors for every item on the desktop (includes files, folders, and
  211.     volumes).
  212.     If an UPP to an idle function is provided in the idleProcUPP parameter,
  213.     AESend is called with a send mode of kAEWaitReply. If idleProcUPP is set
  214.     to nil, kAENoReply will be used for the send mode.
  215.  
  216.     idleProcUPP        input:    A UniversalProcPtr for an idle function, or nil.
  217.     objectList        input:    A null AEDesc.
  218.     iconSelector    output:    A list containing object descriptors,
  219.                             or a null AEDesc if an error is encountered.
  220.     
  221.     Result Codes
  222.     _____________
  223.     noErr                        0        No error
  224.     paramErr                    -50        The value of target or alias parameter, or of both,
  225.                                         is NIL or odd, or the alias record is corrupt
  226.     eLenErr                        -92        Buffer too big to send
  227.     memFullErr                    -108    Not enough room in heap zone
  228.     procNotFound                -600    No eligible process with specified descriptor
  229.     connectionInvalid            -609    Nonexistent signature or session ID
  230.     noUserInteractionAllowed    -610    Background application sends event
  231.                                         requiring authentication
  232.     noPortErr                    -903    Client hasn’t set 'SIZE' resource to indicate
  233.                                         awareness of high-level events
  234.     destPortErr                    -906    Server hasn’t set 'SIZE' resource to indicate
  235.                                         awareness of high-level events, or else is not present
  236.     sessClosedErr                -917    The kAEDontReconnect flag in the sendMode parameter
  237.                                         was set and the server quit, then restarted
  238.     errAECoercionFail             -1700    Data could not be coerced to the
  239.                                         requested Apple event data type    
  240.     errAEWrongDataType            -1703    Wrong Apple event data type    
  241.     errAENotAEDesc                -1704    Not a valid descriptor record
  242.     errAEBadListItem            -1705    Operation involving a list item failed
  243.     errAEEventNotHandled        -1708    Event wasn’t handled by an Apple event handler
  244.     errAEUnknownSendMode        -1710    Invalid sending mode was passed
  245.     errAEWaitCanceled            -1711    User canceled out of wait loop for reply or receipt
  246.     errAETimeout                -1712    Apple event timed out
  247.     errAEUnknownAddressType        -1716    Unknown Apple event address type
  248.     Any error code returned by the event handler of the target application.
  249.     ____________
  250. */
  251.  
  252. // *****************************************************************************
  253.  
  254. pascal    OSErr    MFEUpdateItemFSS( const FSSpecPtr fssPtr );
  255. /*
  256.     Given an FSSpec to an item (file, folder, what ever), send an Apple event to
  257.     the Finder asking it to update it's display of the item. For files, shows
  258.     things like icon changes. For folders, shows things like new files that have
  259.     been added.
  260. */
  261.  
  262. // *****************************************************************************
  263.  
  264. pascal    OSErr    MFEUpdateItemAlias( const AliasHandle aliasHandle );
  265. /*
  266.     Given an alias to an item (file, folder, what ever), send an Apple event to
  267.     the Finder asking it to update it's display of the item. For files, shows
  268.     things like icon changes. For folders, shows things like new files that have
  269.     been added.
  270. */
  271.  
  272. // *****************************************************************************
  273.  
  274. pascal    OSErr MFEOpenFile( const AEIdleUPP idleProcUPP,
  275.                                  FSSpec *fssPtr );
  276. /*
  277.     Given an FSSpec to a file, send an open document event to the
  278.     Finder, passing the FSSpec as the direct parameter.
  279. */
  280.  
  281. #ifdef __cplusplus
  282. }
  283. #endif
  284.  
  285. #ifndef COMPILING_MORE_FINDER_EVENTS
  286. #undef pascal
  287. #endif
  288.  
  289.  
  290. #endif//MOREFINDEREVENTS
  291.